<div class="row">
  <div class="span3 bs-docs-sidebar "> <*include file="<*$controller*>/location.tpl"*> </div>
  <div class="span6">
    <h3>增加新版本</h3>
    <form onSubmit="return checkform()" action="/<*$controller*>/opaddyun" method="post" enctype="multipart/form-data" class="form-horizontal">
      <div class="control-group">
        <label class="control-label" for="version_type1">类别</label>
        <div class="controls">
          <label class="radio inline">
            <input type="radio" name="version_type" id="version_type1" value="1" checked onClick="createUrl()">
            家长版 </label>
          <label class="radio inline">
            <input type="radio" name="version_type" id="version_type2" value="2" onClick="createUrl()">
            教师版 </label>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="version_no">版本号</label>
        <div class="controls">
          <input type="text" class="span2 input-xlarge" placeholder="输入版本号"  name="version_no" id="version_no" onMouseUp="createUrl()" onKeyUp="createUrl()">
          <span class="help-inline">例如：2.1</span> 
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" >选择文件</label>
        <div class="controls"> 
        	<input type="file" name="file_url" id="file_url"  />
          <!-- <span class="input-xlarge " id="version_url_html">http://www.yunxiaoche.com/parents/School_Bus_P?.apk</span>
          <input type="hidden" name="version_url" id="version_url"  value=""/> -->
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" >版本说明</label>
        <div class="controls">
          <textarea name="version_explain" id="version_explain" rows="10" class="span4" placeholder="版本说明"></textarea>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" >链接地址</label>
        <div class="controls"> 
           <span class="input-xlarge " id="version_url_html">http://www.yunxiaoche.com/down.myapp.com/School_Bus_P?.apk</span>
          <input type="hidden" name="version_url" id="version_url"  value=""/> 
        </div>
      </div>
      <div  class="control-group form-actions">
        <button class="btn btn-large btn-block btn-success" type="submit">增加新版本</button>
      </div>
    </form>
  </div>
</div>
<script>
function checkform(){
	var no=document.getElementById('version_no').value;
	var re = /^[0-9]+.?[0-9]*$/;
	if(no==""){
		alert('版本号不能为空或只能为数字');
		document.getElementById('version_no').focus();
		return false;
	}
//	if(!(re.test(no))){
//		alert('版本号不能为空或只能为数字');
//		document.getElementById('version_no').focus();
//		return false;
//	}	
	createUrl();
	
	return true;
}
function createUrl(){
	var no=document.getElementById('version_no').value;
	var id1=document.getElementById('version_type1').checked;
	var id2=document.getElementById('version_type2').checked;		
	
	if(id1==true){
		//var link='http://cloud.yunxiaoche.com/apk/School_Bus_P'+no+'.apk';
		var link='http://www.yunxiaoche.com/down.myapp.com/School_Bus_P'+no+'.apk';
		
	}
	if(id2==true){
		//var link='http://cloud.yunxiaoche.com/apk/School_Bus_T'+no+'.apk';
		var link='http://www.yunxiaoche.com/down.myapp.com/School_Bus_T'+no+'.apk';
	}
	
	document.getElementById('version_url').value=link;
	document.getElementById('version_url_html').innerHTML=link;
}
</script> 
